home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / blitzbasic / blitz-list200994.lha / blitz-list / 000125_blitz-list-request_Tue Jul 26 10:40:18 1994.msg < prev    next >
Internet Message Format  |  1994-09-20  |  5KB

  1. Received: from cs.uml.edu (cs.uml.edu [129.63.1.11]) by kantti.helsinki.fi (8.6.9/8.6.5) with SMTP id KAA27115 for <blitz-list@helsinki.fi>; Tue, 26 Jul 1994 10:39:09 +0300
  2. Received: by cs.uml.edu id AA13092
  3.   (5.67a+/IDA-1.5 for blitz-list@helsinki.fi); Tue, 26 Jul 1994 03:39:04 -0400
  4. From: Ralph Barbagallo <rbarbaga@cs.uml.edu>
  5. Message-Id: <199407260739.AA13092@cs.uml.edu>
  6. Subject: here it is.
  7. To: blitz-list@helsinki.fi
  8. Date: Tue, 26 Jul 1994 03:39:04 -0400 (EDT)
  9. X-Mailer: ELM [version 2.4 PL22]
  10. MIME-Version: 1.0
  11. Content-Type: text/plain; charset="us-ascii"
  12. Content-Transfer-Encoding: 7bit
  13. X-Status: 
  14. Status: RO
  15.  
  16.     Here's the problematic code.
  17.  
  18. ;
  19. ; Space Invaders 2600  v.5b
  20. ; By Ralph A. Barbagallo III (c) 1994
  21. ;
  22. ; This is a clone of the classic Atari 2600 cartridge, Space Invaders
  23. ; Just a simple game to hone my skills.
  24. ;
  25.  
  26. NoCli   ;Disable CLI window for easier debugging and a cleaner WB screen.
  27.  
  28. ;
  29. ;Initialize variables
  30. ;
  31.  
  32. NEWTYPE.ship ;Data for player's ship.
  33. x.q          ;Player ship's x position.
  34. y            ;Player ship's y position.
  35. End NEWTYPE
  36.  
  37. NEWTYPE.shield ;Data for 3 laser shields.
  38. x.q            ;Shield x position.
  39. y              ;Shield y position.
  40. End NEWTYPE
  41.  
  42. NEWTYPE.invader ;Data for each 6x6 matrix alien.
  43. x.q             ;Alien x position.
  44. y               ;Alien y position.
  45. death.b         ;Death flag.
  46. frontman        ;Front row indicator.
  47. End NEWTYPE
  48.  
  49. Dim List ships.ship(0)           ;Dimension a list of ship types.
  50. Dim List shields.shield(3)       ;Dimension a list of shield types.
  51. Dim  invaders.invader(6,6)       ;Dimension a 6x6 matrix of aliens.
  52.  
  53. LoadShape 0,"playership.shape",0  ;Load in shapes from brush file.
  54. LoadShape 1,"bullet.shape",0
  55. LoadShape 2,"mysteryship.shape",0
  56. LoadShape 3,"invshield.shape",0
  57. LoadShape 4,"row1.shape",0
  58. LoadShape 5,"row2.shape",0
  59. LoadShape 6,"row3.shape",0
  60. LoadShape 7,"row4.shape",0
  61. LoadShape 8,"row5.shape",0
  62. LoadShape 9,"row6.shape",0
  63.  
  64. BitMap 0,320,200,3  ;Initialize an 8 color, lo-res bitmap for background.
  65. BitMap 1,320,200,3  ;Initialize 8 color, lo-res bitmap for double buffer.
  66.  
  67. LoadBitMap 0,"invadersbkg.iff",0  ;Load .iff to bitmap for background.
  68. LoadBitMap 1,"invadersbkg.iff",0  ;Load 2nd .iff for double buffering.
  69.  
  70. While AddLast(ships())  ;Initialize ship's position variable.
  71.   ships()\x=140,164
  72. Wend   ;When the last item in the array has been filled, exit loop.
  73.  
  74. While AddLast(shields()) ;Cycle through list of sheilds, initialize vars.
  75.   shields()\x=A.q,140    ;Initialize incremented x value, default y value.
  76.   A.q = A.q+70           ;Increment X value to space shields off.
  77. Wend
  78.  
  79. Xstart.q = 25
  80. For A = 1 To 6
  81.   Ystart.q = 20
  82.   For B = 1 To 6
  83.     invaders (A,B)\x=Xstart,Ystart,0,0
  84.     Ystart.q = Ystart.q+18
  85.   Next
  86.   Xstart.q = Xstart.q+40
  87. Next
  88.  
  89. BLITZ  ;Jump into BLITZ mode now that disk access is through.
  90.  
  91.  
  92. Buffer 0,16384  ;2 Buffers for double buffering action.
  93. Buffer 1,16384
  94.  
  95. Slice 0,44,320,200,$fff0,3,8,32,320,320  ;Initialize slice for bitmap.
  96. Use Palette 0                            ;Use palette 0, gained from .iff file.
  97. Show 0                                   ;Show slice 0, background graphics.
  98.  
  99. ;
  100. ;Manipulate graphics, respond to joystick commands.
  101. ;
  102.  
  103. While Joyb(0)=0                     ;While mousebutton hasn't been pressed.
  104.  
  105.   ResetList ships()                 ;Start at top of shape list.
  106.   VWait                             ;Wait for vertical blank.
  107.   Show db:db=1-db:Use BitMap db     ;Toggle bitmaps for double buffering
  108.   UnBuffer db                       ;Unqueue items in used bitmap.
  109.   While NextItem(ships())           ;while the entire list hasn't been cycled...
  110.  
  111.     If Joyx(1)=  1 Then ships()\x = ships()\x+1  ;adjust x value according
  112.     If Joyx(1)= -1 Then ships()\x = ships()\x-1  ;to joystick movement.
  113.     If ships()\x<50  Then ships()\x=50           ;stop movement at left and
  114.     If ships()\x>225 Then ships()\x=225          ;right borders.
  115.     BBlit db,0,ships()\x,ships()\y               ;draw ship at proper position.
  116.  
  117.   Wend
  118.  
  119. ;
  120. ; Blit shields onto screen.
  121. ;
  122.  
  123.   For a = 1 To 3                           ;Cycle through list of shields.
  124.     BBlit db,3,shields(a)\x,shields(a)\y   ;Blit shields on screen.
  125.   Next
  126.  
  127. ;
  128. ; Blit 6x6 matrix of aliens on screen.
  129. ;
  130.   boundflag = 0
  131.   For A=1 To 6
  132.     If boundflag<>0 Then Pop For
  133.     For B=1 To 6
  134.       If invaders (A,B)\x >310 Then boundflag = 1
  135.       If invaders (A,B)\x <10 Then boundflag = 2
  136.       If boundflag <> 0 Then Pop For
  137.     Next
  138.   Next
  139.  
  140.   Statement LEFT{}
  141.     For A= 1 To 6
  142.       For B=1 To 6
  143.         invaders (A,B)\x = invaders (A,B)\x -2
  144.       Next
  145.     Next
  146.   End Statement
  147.  
  148.   Statement RIGHT{}
  149.     For A= 1 To 6
  150.       For B= 1 To 6
  151.         invaders (A,B)\x = invaders (A,B)\x +2
  152.       Next
  153.     Next
  154.   End Statement
  155.  
  156.   If boundflag = 0 Then LEFT{}
  157.   If boundflag = 1 Then LEFT{}
  158.   If boundflag = 2 Then RIGHT{}
  159.  
  160.   For A=1 To 6                ;Cycle through the 6x6 matrix with nested loops.
  161.    Invader = 4                ;Initial object number (invader graphic 1).
  162.     For B=1 To 6
  163.       BBlit db,Invader,invaders(A,B)\x,invaders(A,B)\y
  164.       Invader = Invader+1     ;Increment object number.
  165.     Next
  166.   Next
  167.  
  168. Wend
  169.  
  170.